package com.bilibili.netty.im.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @program: rgs-study0project
 * @description:
 * @author: Mr.Ren
 * @create: 2023-10-30 23:05
 **/
@Getter
@AllArgsConstructor
public enum CommandTypeEnum {
    CONNECT(1001),
    MESSAGE(1002),



    ERROR(-1);

    private Integer code;

    public static CommandTypeEnum match(Integer code){
        for (CommandTypeEnum value : CommandTypeEnum.values()) {
            if (value.code.equals(code)){
                return value;
            }
        }
        return ERROR;
    }
}
